Attribute VB_Name = "OrtecStructures"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'       ORTECREC.BAS            Structures for Ortec .SPC and .CHN files
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Type RECORD1
    inftyp      As Integer      '1 Must be 1
    filtyp      As Integer      '2 1 for Integer files, 5 for Real files
    dummy1      As Integer      '3 Reserved
    dummy2      As Integer      '4 Reserved
    acqirp      As Integer      '5 Acquisition Info Record
    samdrp      As Integer      '6 Sample Description Record pointer
    detdrp      As Integer      '7 Detector Description Record Pointer
    ebrdesc     As Integer      '8 EBAR Description Record
    anarp1      As Integer      '9 First Analysis Parameters Record Pointer
    anarp2      As Integer      '10 Second Analysis Parameters Record Pointer
    anarp3      As Integer      '11 Third Analysis Parameters Record Pointer
    anarp4      As Integer      '12 Fourth Analysis Parameters Record Pointer
    srpdes      As Integer      '13 Absorption Correction Description Record Pointer
    ieqdesc     As Integer      '14 IEQ description Record Pointer
    geodes      As Integer      '15 Geometry Correction Description Record Pointer
    mpcdesc     As Integer      '16 MPC Description Record Pointer
    caldes      As Integer      '17 Calibration Description Record Pointer
    calrp1      As Integer      '18 First Calibration Description Record Pointer
    calrp2      As Integer      '19 Second Calibration Description Record Pointer
    effrpt      As Integer      '20 Efficiency Pairs Record Pointer
    roirpt      As Integer      '21 Record Number of the first of the two ROI records
    eprp        As Integer      '22 Energy Pairs Record Pointer
    numep       As Integer      '23 Number of energy pair records
    dummy3      As Integer      '24 Reserved
    nodecon     As Integer      '25 Disable deconvolution of unknown peaks
    yesmicro    As Integer      '26 True = MicroCuries, False = becquerels
    perptr      As Integer      '27 Lab & Operator name record pointer
    maxrcs      As Integer      '28 Max Record Number ever used
    lstrec      As Integer      '29 Max Record Number in use
    effpnm      As Integer      '30 Number of Efficiency Pairs Records(see word 20)
    spctrp      As Integer      '31 Spectrum Record Pointer (pointer to first record)
    spcrcn      As Integer      '32 Number of records in the spectrum
    spcchn      As Integer      '33 Number of channels in spectrum
    abstch      As Integer      '34 Physical start channel for data
    acqtim      As Single       '35 Date & time of acquisition DECDAY format
    acqti8      As Double       '37 Date & time as Double precision DECDAY format
    seqnum      As Integer      '41 Sequence number
    mcanu       As Integer      '42 MCA number as two ASCII characters (old) or
                                '   Detector number as integer for systems with Connections
    segnum      As Integer      '43 Segment number as two ASCII chars (old) or as
                                '   Integer value 1 for systems with connections
    mcadvt      As Integer      '44 MCA Device type
    chnstr      As Integer      '45 Start channel number
    rltmdt      As Single       '46 Real time in seconds
    lvtmdt      As Single       '48 Live time in seconds
    dummy30     As String * 30  '50-64 Reserved
    'dummy4     AS INTEGER      '50 Reserved
    'dummy5     AS INTEGER      '51 Reserved
    'dummy6     AS INTEGER      '52 Reserved
    'dummy7     AS INTEGER      '53 Reserved
    'dummy8     AS INTEGER      '54 Reserved
    'dummy9     AS INTEGER      '55 Reserved
    'dummy10    AS INTEGER      '56 Reserved
    'dummy11    AS INTEGER      '57 Reserved
    'dummy12    AS INTEGER      '58 Reserved
    'dummy13    AS INTEGER      '59 Reserved
    'dummy14    AS INTEGER      '60 Reserved
    'dummy15    AS INTEGER      '61 Reserved
    'dummy16    AS INTEGER      '62 Reserved
    'dummy17    AS INTEGER      '63 Reserved
    'dummy18    AS INTEGER      '64 Reserved
End Type

Type ANARP  'Analysis Parameters record is the same as Germanium parameters
    GELI        As Integer
    FCHAN       As Integer
    LCHAN       As Integer
    SIGMA       As Integer
    UNPEKS      As Integer
    ENGCAL      As Integer
    DECDUR      As Integer
    Form        As Integer
    GAMMA3      As Integer
    MPCON       As Integer
    PBCOR       As Integer
    RNDSUM      As Integer
    DECAY       As Integer
    FACCOR1     As Integer 'Reserved
    FACCOR2     As Integer 'Reserved
    EFCALB      As Integer
    MDATYP      As Integer
    LIBNOT      As Integer
    LSTISO      As Integer
    FIVE        As Integer
    SENS        As Single
    RECFCT      As Single
    DETIDN      As Integer
    MATISO      As Integer
    MATCHN      As Integer
    RSFCT       As Single
    SORFCT      As Single
    DAYS        As Double
    SAMWGH      As Single
    UFCTN       As Single
    UFCTD       As Single
    IRRAD       As Single
    PKRPRO      As Single
    GERPRO      As Single
    UNITS       As String * 14
    CORDAT      As String * 10
    CORTIM      As String * 8
    SORP        As Integer
End Type

Type ACQUISITION
    filnam      As String * 16  '1
    AcqDate     As String * 12  '17 DD-MMM-YY The * char should be ignored
                                '   if it is not a "1". If it is a "1", it
                                '   indicates the data is after the year 2000
    acqtime     As String * 10  '29 HH:MM:SS
    acqlive     As String * 10  '39 Live time rounded to seconds
    acqreal     As String * 10  '49 Real time rounded to seconds
    dummy62     As String * 32  '59-89 Reserved
    startdat    As String * 10  '90 Start date of sample collection
    starttim    As String * 8   '104 Start date of sample collection
    stopdate    As String * 10  '111 Start date of sample collection
    stoptime    As String * 8   '121 Start date of sample collection
End Type

Type SAMDESC
    line1       As String * 64
    line2       As String * 64
End Type

Type DETDESC
    line1       As String * 64
    line2       As String * 64
End Type

Type PERSONALITY
    line1       As String * 64
    line2       As String * 64
End Type

Type CALIBREC
    afit        As Integer      'Above knee eff type
    bfit        As Integer      'Below knee eff type
    effprs      As Integer      'Num of eff pairs
    nch         As Integer      'Number of chann in spectrum
    knee        As Single               'Detector knee (keV)
    asig        As Single               '2 Sigma uncert. above knee
    bsig        As Single               '2 Sigma uncert. below knee
    ec1         As Single               'Eng cal factor 1
    ec2         As Single               'Eng cal factor 2
    ec3         As Single               'Eng cal factor 3
    fc1         As Single               'FWHM cal factor 1
    fc2         As Single               'FWHM cal factor 2
    fc3         As Single               'FWHM cal factor 3
    pe1         As Single               'Poly cal factor 1
    pe2         As Single               'Poly cal factor 2
    pe3         As Single               'Poly cal factor 3
    se1         As Single               'Poly cal factor 4
    se2         As Single               'Poly cal factor 5
    se3         As Single               'Poly cal factor 6
    fwhmtyp     As Integer      'FWHM Type
    engprs      As Integer      'Num of eng pairs
    detnum      As Integer      'Detector number
    nbknee      As Integer      'Num of cal points below knee
    ena2        As Single               'Temp eng cal
    enb2        As Single               'Temp eng cal
    enc2        As Single               'Temp eng cal
    calunc      As Single               'Cal source uncert.
    caldif      As Single               'Eng cal diff
    r7          As Single               'Poly cal factor 7
    r8          As Single               'Poly cal factor 8
    r9          As Single               'Poly cal factor 9
    r10         As Single               'Poly cal factor 10
    reserved    As String * 6
End Type

Type CHNHEADER
    itype       As Integer      'Must be -1
    mcanum      As Integer      'MCA Number or Detector number
    segnum      As Integer      'Normally set to 1
    sec         As Integer      'Seconds of start time
    real        As Long         'Real time in 20ms increments
    live        As Long         'Live time in 20ms increments
    AcqDate     As String * 8   'Start date DDMMMYY* If * = 1 it is after y2k
    acqtime     As String * 4   'HHMM
    offset      As Integer
    NumChan     As Integer      'Number of channels in spectrum
End Type                        'Total 32 bytes

Type CHNTRAILER
    itype       As Integer      '-101 is old version, -102 is new version
    dummy       As Integer      'not used
    ecalx0      As Single
    ecalx1      As Single
    ecalx2      As Single       'Not used if type = -101
    fwhmx0      As Single
    fwhmx1      As Single
    fwhmx2      As Single       'Not used if type = -101
    dummy2      As String * 228 'Not used
    lendet      As String * 1   'Length of detector description
    det         As String * 63  'Detector description
    lensam      As String * 1   'Length of sample description
    sam         As String * 63  'Sample description
    dummy3      As String * 128 'Rest of file
End Type                        'Total 512 bytes

